<%@ page language="java"  contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<form id="replyApplyForm" style="padding: 0; margin: 0;">
	<table style="" align="left" class="viewtable" border="0">
		<tr>
			<td height="35" class="viewlabel">
				审核状态：
			</td>
			<td>
			    <select id="bookStatus1" >
			        <option value="1">通过</option>
			        <option value="-1">未通过</option>
			    </select>
			</td>
		</tr>
		<tr>
			<td height="35" class="viewlabel">
				审核结果：
			</td>
			<td>
				<textarea id="bookResultText" cols="40" rows="5" style="resize: none; font-size: 12px;"></textarea>
			</td>
		</tr>
		<tr>
			<td height="35">
				&nbsp;
			</td>
			<td>
				<a href="javascript:void(0)" class="easyui-linkbutton" 
				    onclick="subReplyForm()">确&nbsp;&nbsp;定</a>
				&nbsp;&nbsp;
				<a href="javascript:void(0)" class="easyui-linkbutton"
					onclick='$("#replyApplyWindow").window("close")'>关&nbsp;&nbsp;闭</a>
			</td>
		</tr>
	</table>
</form>
<!-- <script type="text/javascript" src="../js/admin/replyApply.js"></script> -->
<script type="text/javascript">
var bookId = 0;
//赋值
(function setReplyApplyForm() {
	var form = $("#replyApplyForm");
	var param = $('#replyApplyWindow').panel('options').param;
	var row = param.row;
	var template = param.template;
	if (row) {
		$(form).form("load", row);
		bookId = row.bookId;
		var bookStatus = $("#bookStatus");
		var bookResultText = $("#bookResultText");
		
		bookStatus.combobox({
			onChange: function(newValue, oldValue)
			{
				if(newValue == -1)
					bookResultText.val("");
				else if(newValue == 1)
					bookResultText.val(template);
			}
		});
		if (row.bookStatus == 0) {
			bookStatus.removeAttr("disabled");
			bookResultText.val(template);
		} else {
			bookStatus.attr("disabled", "disabled");
			bookResultText.val(row.bookResultText);
		}
	} else {
		$(form).form("load", []);
	}
})();

function subReplyForm() {
	var bookStatus = $("#bookStatus1").val();
	var bookResultText = $("#bookResultText").val();
	if (bookResultText == "") {
		alert("请填写审核结果!");
		return false;
	}
	$.post("SaveReply", {bookId : bookId, bookStatus : bookStatus, bookResultText : bookResultText }, function(text) {
		var data = (new Function("return " + text))();
		alert(data.status);
		if (data.status == '审核成功') {
			var param = $('#replyApplyWindow').panel('options').param;
			var row = param.row;
			var index = param.index;
			row.bookStatus = bookStatus;
			row.bookResultText = bookResultText;
			param.callback(row, index);
			$("#replyApplyWindow").window('close');
		}
	});
}

</script>